<template>
  <el-dialog
    title="MCP接入点"
    :visible.sync="open"
    :before-close="cancel"
    width="600px"
    append-to-body
  >
    <div class="contxt">
      <p>接入点状态</p>
      <ul>
        <li>
          未连接
          <el-button size="mini" icon="el-icon-refresh" @click="handleMCPRefresh"
            >刷新</el-button
          >
        </li>
      </ul>
      <p>接入点地址</p>
      <p>以下是智能体的MCP接入点地址。<el-link> 查看接入点使用文档</el-link></p>
      <div class="txt">
        <p :class="{ on: !show }">
          token=eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOjMzNTQ5OCwiYWdlbnRJZCI6NTExMTUxLCJlbmRwb2ludElkIjoiYWdlbnRfNTExMTUxIiwicHVycG9zZSI6Im1jcC1lbmRwb2ludCIsImlhdCI6MTc1Mzc3MTg2M30.vjEioNaSrNYURRr2pekngjeb6PhEiQxA5k3CVMxZ8slOdWIdjvN8ggGPqNTbH_gs0J0mtxHJ1r_TowFghRKvRg
        </p>
        <el-button size="mini" type="text" @click="show = !show">{{
          show ? "隐藏" : "显示"
        }}</el-button>
      </div>
      <div class="dialog-footer">
        <el-button
          type="primary"
          icon="el-icon-document-copy"
          size="mini"
          @click="handleCopy"
          >复制</el-button
        >
      </div>
    </div>
  </el-dialog>
</template>

<script>
export default {
  props: {
    open: {
      type: Boolean,
      default: false,
    },
  },
  data() {
    return {
      show: false,
    };
  },
  methods: {
    cancel() {
      this.$emit("cancel");
    },
    handleCopy() {
      this.$modal.msgSuccess("复制成功");
    },
    handleMCPRefresh() {
      this.$modal.msgSuccess("刷新成功");
    },
  },
};
</script>

<style scoped lang="scss">
.contxt {
  padding: 0 20px;
  ul {
    margin-left: 20px;
    margin-bottom: 10px;
  }
  p {
    font-size: 14px;
    line-height: 1.58;
    color: #333;
    margin-bottom: 10px;
  }
  .txt {
    background-color: #f5f5f5;
    padding: 8px 12px;
    border-radius: 4px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    p {
      margin-bottom: 0;
    }
    .on {
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
  }
}
.dialog-footer {
  width: 100%;
  display: flex;
  justify-content: flex-end;
}
</style>
